package own.stu.jobgib.playown.dp.principle.isp;

import own.stu.jobgib.playown.dp.principle.isp.service.ScheduledUpdater;
import own.stu.jobgib.playown.dp.principle.isp.service.SimpleHttpServer;

public class Application {
    private static final ConfigSource configSource = new ConfigSource();
    private static final RedisConfig redisConfig = new RedisConfig(configSource);
    private static final KafkaConfig kafkaConfig = new KafkaConfig();
    private static final MysqlConfig mysqlConfig = new MysqlConfig();

    public static void main(String[] args) {

        // 热更新的需求
        ScheduledUpdater redisUpdater = new ScheduledUpdater(4, 10, redisConfig);
        redisUpdater.run();

        ScheduledUpdater kafkaUpdater = new ScheduledUpdater(4, 10, kafkaConfig);
        kafkaUpdater.run();

        SimpleHttpServer simpleHttpServer = new SimpleHttpServer("127.0.0.1", 2);
        simpleHttpServer.addViewer("/config", redisConfig);
        simpleHttpServer.addViewer("/config", mysqlConfig);
        simpleHttpServer.run();
    }
}
